foreach data in $datafilesfirm {

	* Set globals:
		global dataspec `data'
		global n = 2
		global rhs1 diff_ln_IND 
		global rhs2 diff_wIPT_IND_CHN
		global ivs1 diff_ln_IVS 
		global ivs2 diff_wIPT_LMI_CHN_EXCL_IND
		global ctrl 
	do "$code/estimation/flexible/firm_regs_bs.do"

	* Set globals:
		global dataspec `data'
		global n = 3
		global rhs1 diff_ln_IND 
		global rhs2 
		global ivs1 diff_ln_IVS 
		global ivs2 
		global ctrl diff_wIPT_LMI_CHN_EXCL_IND
	do "$code/estimation/flexible/firm_regs_bs.do"

	use "$tempfold/bs2_`data'", clear
	merge 1:1 bs using "$tempfold/bs3_`data'", nogen
	save "$tempfold/cbs", replace
	
	clear
	use "$BS_fold/bs_`data'"
	append using "$tempfold/cbs"
	save "$BS_fold/bs_`data'", replace
}
